YUI.add("hermes-template-sub-photo-tags-tag-section",function(a,t){var n=a.Template.Handlebars.revive({1:function(a,t,n,l,e){return'\t<a href="#" class="show-add-tags">'+a.escapeExpression((n.intlMessage||t&&t.intlMessage||n.helperMissing).call(null!=t?t:{},{name:"intlMessage",hash:{intlName:"photo-page-scrappy.ADD_TAGS"},data:e}))+"</a>\n"},3:function(a,t,n,l,e){var s,o=null!=t?t:{},r=n.helperMissing,i=a.escapeExpression;return'\t<a class="tag-section-header" href="'+i("function"==typeof(s=null!=(s=n.tagPageURL||(null!=t?t.tagPageURL:t))?s:r)?s.call(o,{name:"tagPageURL",hash:{},data:e}):s)+'">'+i((n.intlMessage||t&&t.intlMessage||r).call(o,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.TAGS"},data:e}))+"</a>\n"},5:function(a,t,n,l,e){return'\t<h3 class="tag-section-header">'+a.escapeExpression((n.intlMessage||t&&t.intlMessage||n.helperMissing).call(null!=t?t:{},{name:"intlMessage",hash:{intlName:"photo-page-scrappy.TAGS"},data:e}))+"</h3>\n"},7:function(a,t,n,l,e){return'\t<span class="autotags-helper">\n\t\t<i class="autotags-helper-icon"></i>\n\t</span>\n'},9:function(a,t,n,l,e){return'\t\t<input type="text" class= "add-tag" placeholder="'+a.escapeExpression((n.intlMessage||t&&t.intlMessage||n.helperMissing).call(null!=t?t:{},{name:"intlMessage",hash:{intlName:"photo-page-scrappy.ADD_A_TAG"},data:e}))+'">\n'},11:function(a,t,n,l,e){var s,o,r=null!=t?t:{},i=n.helperMissing,u=a.escapeExpression;return'\t\t<li data-author="'+u("function"==typeof(o=null!=(o=n.tagAuthorNSID||(null!=t?t.tagAuthorNSID:t))?o:i)?o.call(r,{name:"tagAuthorNSID",hash:{},data:e}):o)+'" data-tag-id="'+u("function"==typeof(o=null!=(o=n.id||(null!=t?t.id:t))?o:i)?o.call(r,{name:"id",hash:{},data:e}):o)+'" class="tag '+(null!=(s=(n.canRemoveTag||t&&t.canRemoveTag||i).call(r,null!=t?t.tagAuthorNSID:t,(s=e&&e.root)&&s.viewerNSID,(s=e&&e.root)&&s.isOwner,{name:"canRemoveTag",hash:{},fn:a.program(12,e,0),inverse:a.noop,data:e}))?s:"")+'" '+(null!=(s=n.if.call(r,(s=e&&e.root)&&s.autotagsEnabled,{name:"if",hash:{},fn:a.program(14,e,0),inverse:a.noop,data:e}))?s:"")+' data-track="tagClick">\n\t\t\t<a class="'+(null!=(s=n.if.call(r,(s=e&&e.root)&&s.autotagsEnabled,{name:"if",hash:{},fn:a.program(17,e,0),inverse:a.program(20,e,0),data:e}))?s:"")+'" href="#">\n\t\t\t\t<i class="'+(null!=(s=n.if.call(r,(s=e&&e.root)&&s.autotagsEnabled,{name:"if",hash:{},fn:a.program(22,e,0),inverse:a.program(25,e,0),data:e}))?s:"")+'" title="'+u((n.intlMessage||t&&t.intlMessage||i).call(r,{name:"intlMessage",hash:{intlName:"common.DELETE"},data:e}))+'"></i>\n\t\t\t</a>\n\t\t\t<a href="'+(null!=(s=n.if.call(r,(s=e&&e.root)&&s.linkTagToTagsPage,{name:"if",hash:{},fn:a.program(27,e,0),inverse:a.program(29,e,0),data:e}))?s:"")+'" title="'+u("function"==typeof(o=null!=(o=n.tagRaw||(null!=t?t.tagRaw:t))?o:i)?o.call(r,{name:"tagRaw",hash:{},data:e}):o)+'">'+u("function"==typeof(o=null!=(o=n.tagRaw||(null!=t?t.tagRaw:t))?o:i)?o.call(r,{name:"tagRaw",hash:{},data:e}):o)+"</a>\n\t\t</li>\n"},12:function(a,t,n,l,e){return"can-remove-tag"},14:function(a,t,n,l,e){var s;return null!=(s=n.if.call(null!=t?t:{},null!=t?t.duplicateAutotagId:t,{name:"if",hash:{},fn:a.program(15,e,0),inverse:a.noop,data:e}))?s:""},15:function(a,t,n,l,e){var s;return'data-autotag-id="'+a.escapeExpression("function"==typeof(s=null!=(s=n.duplicateAutotagId||(null!=t?t.duplicateAutotagId:t))?s:n.helperMissing)?s.call(null!=t?t:{},{name:"duplicateAutotagId",hash:{},data:e}):s)+'"'},17:function(a,t,n,l,e){var s;return null!=(s=n.if.call(null!=t?t:{},null!=t?t.duplicateAutotagId:t,{name:"if",hash:{},fn:a.program(18,e,0),inverse:a.program(20,e,0),data:e}))?s:""},18:function(a,t,n,l,e){return"remove-dual-tag"},20:function(a,t,n,l,e){return"remove-tag"},22:function(a,t,n,l,e){var s;return null!=(s=n.if.call(null!=t?t:{},null!=t?t.duplicateAutotagId:t,{name:"if",hash:{},fn:a.program(23,e,0),inverse:a.program(25,e,0),data:e}))?s:""},23:function(a,t,n,l,e){return"delete-dual-tag"},25:function(a,t,n,l,e){return"delete-tag"},27:function(a,t,n,l,e){var s;return a.escapeExpression("function"==typeof(s=null!=(s=n.url||(null!=t?t.url:t))?s:n.helperMissing)?s.call(null!=t?t:{},{name:"url",hash:{},data:e}):s)},29:function(a,t,n,l,e){var s;return a.escapeExpression("function"==typeof(s=null!=(s=n.searchUrl||(null!=t?t.searchUrl:t))?s:n.helperMissing)?s.call(null!=t?t:{},{name:"searchUrl",hash:{},data:e}):s)},31:function(a,t,n,l,e){var s;return null!=(s=n.each.call(null!=t?t:{},null!=t?t.autotags:t,{name:"each",hash:{},fn:a.program(32,e,0),inverse:a.noop,data:e}))?s:""},32:function(a,t,n,l,e){var s;return null!=(s=n.if.call(null!=t?t:{},null!=t?t.isPrivate:t,{name:"if",hash:{},fn:a.program(33,e,0),inverse:a.program(38,e,0),data:e}))?s:""},33:function(a,t,n,l,e){var s,o,r=null!=t?t:{},i=n.helperMissing,u=a.escapeExpression;return'\t\t\t\t<li class="autotag private '+(null!=(s=n.if.call(r,(s=e&&e.root)&&s.viewerIsOwner,{name:"if",hash:{},fn:a.program(12,e,0),inverse:a.noop,data:e}))?s:"")+'" data-autotag-content="'+u("function"==typeof(o=null!=(o=n.autotagValue||(null!=t?t.autotagValue:t))?o:i)?o.call(r,{name:"autotagValue",hash:{},data:e}):o)+'" data-autotag-id="'+u("function"==typeof(o=null!=(o=n.id||(null!=t?t.id:t))?o:i)?o.call(r,{name:"id",hash:{},data:e}):o)+'" data-track="autotagClick">\n'+(null!=(s=n.if.call(r,(s=e&&e.root)&&s.viewerIsOwner,{name:"if",hash:{},fn:a.program(34,e,0),inverse:a.noop,data:e}))?s:"")+'\t\t\t\t\t<span class="private-autotag">\n\t\t\t\t\t\t<i class="private-autotag-icon" title="'+u(a.lambda((s=e&&e.root)&&s.privateAutotagHelperText,t))+'"></i>\n\t\t\t\t\t</span>\n\t\t\t\t\t<a href="'+(null!=(s=n.if.call(r,(s=e&&e.root)&&s.linkTagToTagsPage,{name:"if",hash:{},fn:a.program(36,e,0),inverse:a.program(29,e,0),data:e}))?s:"")+'" title="'+u("function"==typeof(o=null!=(o=n.autotagValue||(null!=t?t.autotagValue:t))?o:i)?o.call(r,{name:"autotagValue",hash:{},data:e}):o)+'">'+u("function"==typeof(o=null!=(o=n.autotagValue||(null!=t?t.autotagValue:t))?o:i)?o.call(r,{name:"autotagValue",hash:{},data:e}):o)+"</a>\n\t\t\t\t</li>\n"},34:function(a,t,n,l,e){return'\t\t\t\t\t\t<span class="remove-autotag">\n\t\t\t\t\t\t\t<i class="delete-autotag" title="'+a.escapeExpression((n.intlMessage||t&&t.intlMessage||n.helperMissing).call(null!=t?t:{},{name:"intlMessage",hash:{intlName:"common.DELETE"},data:e}))+'"></i>\n\t\t\t\t\t\t</span>\n'},36:function(a,t,n,l,e){var s,o,r=a.escapeExpression;return r(a.lambda((s=e&&e.root)&&s.tagPageURL,t))+r("function"==typeof(o=null!=(o=n.autotagValue||(null!=t?t.autotagValue:t))?o:n.helperMissing)?o.call(null!=t?t:{},{name:"autotagValue",hash:{},data:e}):o)},38:function(a,t,n,l,e){var s,o,r=null!=t?t:{},i=n.helperMissing,u=a.escapeExpression;return'\t\t\t\t<li class="autotag '+(null!=(s=n.if.call(r,(s=e&&e.root)&&s.viewerIsOwner,{name:"if",hash:{},fn:a.program(12,e,0),inverse:a.noop,data:e}))?s:"")+'" data-autotag-content="'+u("function"==typeof(o=null!=(o=n.autotagValue||(null!=t?t.autotagValue:t))?o:i)?o.call(r,{name:"autotagValue",hash:{},data:e}):o)+'" data-autotag-id="'+u("function"==typeof(o=null!=(o=n.id||(null!=t?t.id:t))?o:i)?o.call(r,{name:"id",hash:{},data:e}):o)+'" data-track="autotagClick">\n'+(null!=(s=n.if.call(r,(s=e&&e.root)&&s.viewerIsOwner,{name:"if",hash:{},fn:a.program(34,e,0),inverse:a.noop,data:e}))?s:"")+'\t\t\t\t\t<a href="'+(null!=(s=n.if.call(r,(s=e&&e.root)&&s.linkTagToTagsPage,{name:"if",hash:{},fn:a.program(36,e,0),inverse:a.program(29,e,0),data:e}))?s:"")+'" title="'+u("function"==typeof(o=null!=(o=n.autotagValue||(null!=t?t.autotagValue:t))?o:i)?o.call(r,{name:"autotagValue",hash:{},data:e}):o)+'">'+u("function"==typeof(o=null!=(o=n.autotagValue||(null!=t?t.autotagValue:t))?o:i)?o.call(r,{name:"autotagValue",hash:{},data:e}):o)+"</a>\n\t\t\t\t</li>\n"},40:function(a,t,n,l,e){var s,o,r=null!=t?t:{},i=n.helperMissing,u=a.escapeExpression;return'\t\t\t<li data-author="'+u("function"==typeof(o=null!=(o=n.tagAuthorNSID||(null!=t?t.tagAuthorNSID:t))?o:i)?o.call(r,{name:"tagAuthorNSID",hash:{},data:e}):o)+'" data-tag-id="'+u("function"==typeof(o=null!=(o=n.id||(null!=t?t.id:t))?o:i)?o.call(r,{name:"id",hash:{},data:e}):o)+'" class="tag '+(null!=(s=(n.canRemoveTag||t&&t.canRemoveTag||i).call(r,null!=t?t.tagAuthorNSID:t,(s=e&&e.root)&&s.viewerNSID,(s=e&&e.root)&&s.isOwner,{name:"canRemoveTag",hash:{},fn:a.program(12,e,0),inverse:a.noop,data:e}))?s:"")+'" data-track="tagClick">\n\t\t\t\t<a class="remove-tag" href="#">\n\t\t\t\t\t<i class="delete-tag" title="'+u((n.intlMessage||t&&t.intlMessage||i).call(r,{name:"intlMessage",hash:{intlName:"common.DELETE"},data:e}))+'"></i>\n\t\t\t\t</a>\n\t\t\t\t<a href="'+(null!=(s=n.if.call(r,(s=e&&e.root)&&s.linkTagToTagsPage,{name:"if",hash:{},fn:a.program(27,e,0),inverse:a.program(29,e,0),data:e}))?s:"")+'" title="'+u("function"==typeof(o=null!=(o=n.tagRaw||(null!=t?t.tagRaw:t))?o:i)?o.call(r,{name:"tagRaw",hash:{},data:e}):o)+'">'+u("function"==typeof(o=null!=(o=n.tagRaw||(null!=t?t.tagRaw:t))?o:i)?o.call(r,{name:"tagRaw",hash:{},data:e}):o)+"</a>\n\t\t\t</li>\n"},compiler:[7,">= 4.0.0"],main:function(a,t,n,l,e){var s,o=null!=t?t:{};return(null!=(s=n.if.call(o,null!=t?t.canAddMeta:t,{name:"if",hash:{},fn:a.program(1,e,0),inverse:a.noop,data:e}))?s:"")+"\n"+(null!=(s=n.if.call(o,null!=t?t.linkTagToTagsPage:t,{name:"if",hash:{},fn:a.program(3,e,0),inverse:a.program(5,e,0),data:e}))?s:"")+"\n"+(null!=(s=n.if.call(o,null!=t?t.showTagInfoBlock:t,{name:"if",hash:{},fn:a.program(7,e,0),inverse:a.noop,data:e}))?s:"")+'\n<ul class="tags-list">\n'+(null!=(s=n.if.call(o,null!=t?t.canAddMeta:t,{name:"if",hash:{},fn:a.program(9,e,0),inverse:a.noop,data:e}))?s:"")+(null!=(s=n.each.call(o,null!=t?t.tags:t,{name:"each",hash:{},fn:a.program(11,e,0),inverse:a.noop,data:e}))?s:"")+(null!=(s=n.if.call(o,null!=t?t.autotagsEnabled:t,{name:"if",hash:{},fn:a.program(31,e,0),inverse:a.noop,data:e}))?s:"")+'\n\t<div style="clear:both;"></div>\n</ul>\n\n<div style="clear:both;"></div>\n\n<div class="machine-tags-section">\n\t<ul class="machine-tags-list">\n'+(null!=(s=n.each.call(o,null!=t?t.machineTags:t,{name:"each",hash:{},fn:a.program(40,e,0),inverse:a.noop,data:e}))?s:"")+'\t</ul>\n\n\t<div style="clear:both;"></div>\n</div>\n'},useData:!0}),l={};a.Array.each([],function(t){var n=a.Template.get("hermes/"+t);n&&(l[t]=n)}),a.Template.register("hermes/sub-photo-tags-tag-section",function(t,e){return e=e||{},e.partials=e.partials?a.merge(l,e.partials):l,n(t,e)})},"@VERSION@",{requires:["template-base","handlebars-base"]});YUI.add("hermes-template-sub-photo-tags-tag",function(a,e){var t=a.Template.Handlebars.revive({1:function(a,e,t,l,n){return'data-tag-might-exist="true"'},3:function(a,e,t,l,n){return"remove-dual-tag"},5:function(a,e,t,l,n){return"remove-tag"},7:function(a,e,t,l,n){return"delete-dual-tag"},9:function(a,e,t,l,n){return"delete-tag"},11:function(a,e,t,l,n){var r,s=null!=e?e:{},i=t.helperMissing,u=a.escapeExpression;return u("function"==typeof(r=null!=(r=t.tagPageURL||(null!=e?e.tagPageURL:e))?r:i)?r.call(s,{name:"tagPageURL",hash:{},data:n}):r)+u("function"==typeof(r=null!=(r=t.tagWithoutSlashes||(null!=e?e.tagWithoutSlashes:e))?r:i)?r.call(s,{name:"tagWithoutSlashes",hash:{},data:n}):r)},13:function(a,e,t,l,n){return a.escapeExpression((t.getTagSearchUrl||e&&e.getTagSearchUrl||t.helperMissing).call(null!=e?e:{},null!=e?e.tagValue:e,{name:"getTagSearchUrl",hash:{},data:n}))},compiler:[7,">= 4.0.0"],main:function(a,e,t,l,n){var r,s,i=null!=e?e:{},u=t.helperMissing,g=a.escapeExpression;return'<li data-tag-id="'+g("function"==typeof(s=null!=(s=t.escapedTagRaw||(null!=e?e.escapedTagRaw:e))?s:u)?s.call(i,{name:"escapedTagRaw",hash:{},data:n}):s)+'" '+(null!=(r=t.if.call(i,null!=e?e.mightExist:e,{name:"if",hash:{},fn:a.program(1,n,0),inverse:a.noop,data:n}))?r:"")+' class="tag" data-validated="false" data-track="tagClick">\n\t<a class="'+(null!=(r=t.if.call(i,null!=e?e.isDualTag:e,{name:"if",hash:{},fn:a.program(3,n,0),inverse:a.program(5,n,0),data:n}))?r:"")+'" href="#">\n\t\t<i class="'+(null!=(r=t.if.call(i,null!=e?e.isDualTag:e,{name:"if",hash:{},fn:a.program(7,n,0),inverse:a.program(9,n,0),data:n}))?r:"")+'" title="Delete"></i>\n\t</a>\n\t<a href="'+(null!=(r=t.if.call(i,null!=e?e.linkTagToTagsPage:e,{name:"if",hash:{},fn:a.program(11,n,0),inverse:a.program(13,n,0),data:n}))?r:"")+'" title="'+g("function"==typeof(s=null!=(s=t.tagRaw||(null!=e?e.tagRaw:e))?s:u)?s.call(i,{name:"tagRaw",hash:{},data:n}):s)+'">'+g("function"==typeof(s=null!=(s=t.tagRaw||(null!=e?e.tagRaw:e))?s:u)?s.call(i,{name:"tagRaw",hash:{},data:n}):s)+"</a>\n</li>\n"},useData:!0}),l={};a.Array.each([],function(e){var t=a.Template.get("hermes/"+e);t&&(l[e]=t)}),a.Template.register("hermes/sub-photo-tags-tag",function(e,n){return n=n||{},n.partials=n.partials?a.merge(l,n.partials):l,t(e,n)})},"@VERSION@",{requires:["template-base","handlebars-base"]});YUI.add("hermes-template-tags-helper-text",function(e,a){var t=e.Template.Handlebars.revive({compiler:[7,">= 4.0.0"],main:function(e,a,t,s,r){var l=null!=a?a:{},n=t.helperMissing,i=e.escapeExpression;return'<div class="tags-helper-text">\n\t'+i((t.intlMessage||a&&a.intlMessage||n).call(l,{name:"intlMessage",hash:{intlName:"photo-page-scrappy.TAGS_HELP_TEXT"},data:r}))+'\n</div>\n<a href="https://help.flickr.com/en_us/tag-keywords-in-flickr-BJUJpQoyX" target="_blank">'+i((t.intlMessage||a&&a.intlMessage||n).call(l,{name:"intlMessage",hash:{intlName:"common.LEARN_MORE"},data:r}))+"</a>\n"},useData:!0}),s={};e.Array.each([],function(a){var t=e.Template.get("hermes/"+a);t&&(s[a]=t)}),e.Template.register("hermes/tags-helper-text",function(a,r){return r=r||{},r.partials=r.partials?e.merge(s,r.partials):s,t(a,r)})},"@VERSION@",{requires:["template-base","handlebars-base"]});YUI.add("sub-photo-tags-tag-view",function(t,e){var a=require("hermes-core/flog")(e),s={tagHoverMaxWidth:23};t.FlickrView.create(this.name,t.FlickrView,[],{langBundles:this.details.langBundles,initializer:function(e){return this.photoId=e.photoId,this.context=t.clone(e.context,!0),this.nsid=e.nsid,this.pathAlias=e.pathAlias,this.isMobileTags=e.isMobileTags||!1,""===this.get("container").get("innerHTML")&&this.setContainerHTML(""),this},loadState:function(){var e=this;return new t.FlickrPromise({photo:e.appContext.getModel("photo-models",e.photoId),photoTags:e.appContext.getModel("photo-tags-models",this.photoId),tagModel:e.appContext.getModelRegistry("tag-models"),photoAutotags:e.appContext.getModel("photo-autotags-models",e.photoId),autotagModel:e.appContext.getModelRegistry("autotag-models")}).then(function(t){e.set("photo",t.photo),e.set("photoTags",t.photoTags),e.set("tagModel",t.tagModel),e.set("photoAutotags",t.photoAutotags),e.set("autotagModel",t.autotagModel)})},buildContainer:function(){var t,e=this.get("photo"),a=this.get("photoTags").getValue("tags"),s=e.getValue("isOwner")||e.getValue("canAddMeta"),o=/^[a-zA-Z]\w*:[a-zA-Z]\w*=.+/,n=[],i=[],l=!1,g=!1,r=!1,h=this.get("photoAutotags").getValue("autotags"),d=e.getValue("isOwner"),u=!1,p=!this.isMobileTags,c=this.appContext.flipper.isFlipped("enable-tag-page-link-on-photo-page");if(a&&0!==(a=a.toJSON()).length)for(l=!0,t=0;t<a.length;t++)o.test(a[t].tagRaw)?n.push(a[t]):i.push(a[t]);return h&&0!==(h=h.toJSON()).length&&(g=!0,u=d?this.intlMessage({intlName:"photo-page-scrappy.PRIVATE_TAGS_OWNER_HELPER_TEXT"}):this.intlMessage({intlName:"photo-page-scrappy.PRIVATE_TAGS_FRIENDS_FAMILY_HELPER_TEXT"})),l||g||(r=!0),r&&s&&(this.get("container").addClass("empty"),this.fire("subviewViewEvent","tagsTagView:tagsEmpty")),!s&&r||this.setContainerWithTemplate("sub-photo-tags-tag-section",{tags:i,machineTags:n,autotags:h,viewerIsOwner:d,privateAutotagHelperText:u,canAddMeta:e.getValue("isOwner")||e.getValue("canAddMeta"),viewerNSID:this.appContext.getViewer().nsid,isOwner:e.getValue("isOwner"),autotagsEnabled:!0,showTagInfoBlock:p,linkTagToTagsPage:c,tagPageURL:"/photos/tags/"}),this},activate:function(){var e,a=this.get("photo"),s=this.get("container"),o=a.getValue("owner")||a.getValue("canAddMeta"),n=this.get("photoTags").getValue("tags"),i=/^[a-zA-Z]\w*:[a-zA-Z]\w*=.+/,l=[],g=s.one(".autotags-helper"),r=this;for(n&&(n=n.toJSON()),0===n.length&&this.fire("subviewViewEvent","noTags"),e=0;e<n.length;e++)i.test(n[e].tagRaw)&&l.push(n[e]);return l.length&&s.one(".machine-tags-section").setStyle("display","block"),!this.isMobileTags&&o&&s.one(".show-add-tags")&&(s.one(".show-add-tags").on("click",function(t){t.preventDefault(),s.hasClass("empty")&&(s.removeClass("empty"),r.fire("subviewViewEvent","tagsTagView:tagsNotEmpty")),s.one(".add-tag").setStyle("display","block"),s.one(".add-tag").focus()}),this.setupAddTagEvents(),this.setupRollOverTagEvents(),this.setupRemoveTagEvents(),this.registerEventHandler(t.on("flickr:photo-page--new-tags-added",function(){r.buildContainer(),r.setupRollOverTagEvents(),r.setupRemoveTagEvents()})),this.registerEventHandler(t.on("flickr:photo-page:focus_tag_entry",function(t){var e=r.get("container");e&&e.one(".tags-list .add-tag")&&e.one(".tags-list .add-tag").focus()})),this.attachKeyEvent("down:84",function(t){t.preventDefault();try{s.hasClass("empty")&&(s.removeClass("empty"),r.fire("subviewViewEvent","tagsTagView:tagsNotEmpty")),s.one(".add-tag").setStyle("display","block"),s.one(".add-tag").focus()}catch(t){}})),!this.isMobileTags&&g&&this.registerEventHandler(g.on("click",function(t){r.showAutotagsHelper(t)},g)),this},setupAddTagEvents:function(){var t=this.get("container"),e=this;this.registerEventHandler(t.one(".add-tag").on("keydown",function(t){13===t.charCode?(t.preventDefault(),this.blur()):27===t.charCode&&(t.preventDefault(),this.setAttribute("data-prevent-auto-save",!0),this.blur())})),this.registerEventHandler(t.one(".add-tag").on("blur",function(){var a=this,s=a.get("value");""!==s&&(a.hasAttribute("data-prevent-auto-save")?a.removeAttribute("data-prevent-auto-save"):(a.set("value",""),0===s.length&&(s='""'),'""'!==s.trim()&&""!==s.trim()?(t.one(".tags-list").all(".end-of-the-line").removeClass("end-of-the-line"),t.one(".tags-list").all(".not-eol").removeClass("not-eol"),"block"===t.one(".machine-tags-section").getStyle("display")&&(t.one(".machine-tags-list").all(".end-of-the-line").removeClass("end-of-the-line"),t.one(".machine-tags-list").all(".not-eol").removeClass("not-eol")),e.saveTag(s),setTimeout(function(){a.focus()},4)):this.set("text","")))}))},_whichTagList:function(){var t=/^[a-zA-Z]\w*:[a-zA-Z]\w*=.+/,e=this.get("container"),a=[e.one(".machine-tags-list"),e.one(".tags-list")];return function(e){return t.test(e)?a[0]:a[1]}},saveTag:function(e){var a,s,o=this.get("container"),n=this.get("tagModel"),i=this.get("photoTags").getValue("tags"),l=this.get("photoAutotags").getValue("autotags"),g=!1,r=!1,h=this._whichTagList(),d=this;s=this.processTag(e),a=s.map(function(t){return t.toLowerCase()}),g=i.getList().some(function(t){return-1!==a.indexOf(t.getValue("tagValue").toLowerCase())}),r=l.getList().some(function(t){return-1!==a.indexOf(t.getValue("autotagValue").toLowerCase())}),n.remoteCreate({photoId:[d.photoId],tags:[e]}).then(function(e){e.forEach(function(t){var e,a=t.getValue("tagRaw"),s=t.getValue("duplicateAutotagId"),o=h(a),n=o.one("[data-tag-id='"+escape(a)+"']");n.setAttribute("data-tag-id",t.getValue("id")),n.setAttribute("data-validated","true"),n.setAttribute("data-tag-might-exist","false"),n.setAttribute("data-author",t.getValue("tagAuthorNSID")),n.addClass("can-remove-tag"),s&&(e=o.one("[data-autotag-content='"+a+"']"),n.setAttribute("data-autotag-id",t.getValue("duplicateAutotagId")),e.remove(!0))}),t.all("[data-tag-might-exist='true']").set("text",d.intlMessage({intlName:"photo-page-scrappy.DUPLICATE_TAG"})).setAttribute("data-validated","true").addClass("invalid-tag"),t.all("[data-validated='false']").set("text",d.intlMessage({intlName:"photo-page-scrappy.INVALID_TAG"})).addClass("invalid-tag"),clearTimeout(d.invalidTagRemoval),d.invalidTagRemoval=setTimeout(function(){o.all(".invalid-tag").remove(!0)},4500)},function(t){var e;e=o.all("[data-validated='false']"),o.all(".autotag").removeClass("hidden"),e.size()&&e.remove(),2===t.code?d.onError(d.intlMessage({intlName:"photo-page-scrappy.MAX_TAG_LIMIT"})):d.onError(d.intlMessage({intlName:"photo-page-scrappy.ERROR_ADDING_TAG"}))}),s.forEach(function(t){var e,a,s,n=h(t).show(),i=n.hasClass("machine-tags-list"),l=d.appContext.flipper.isFlipped("enable-tag-page-link-on-photo-page"),u={tagValue:t.replace(/\s/g,""),tagRaw:t,escapedTagRaw:escape(t),mightExist:g,isDualTag:r,tagWithoutSlashes:t.replace(/\//g,""),linkTagToTagsPage:l,tagPageURL:"/photos/tags/"};i?(t.indexOf(" ")>0?(a=t.indexOf("=")+1,s=t.substring(0,a)+'"'+t.substring(a)+'"',u.tagValue=s):u.tagValue=t,"none"===o.one(".machine-tags-section").getStyle("display")&&o.one(".machine-tags-section").setStyle("display","block"),e=d.templates("sub-photo-tags-tag")(u),n.prepend(e)):(u.tagValue=t.replace(/\s/g,""),e=d.templates("sub-photo-tags-tag")(u),r&&n.one("[data-autotag-content='"+t+"']").addClass("hidden"),n.one(".add-tag").insert(e,"after"))}),d.setupRollOverTagEvents()},setupRemoveTagEvents:function(){var e=this.get("container"),s=this.get("photoTags").getValue("tags"),o=this.get("tagModel"),n=this.get("photoAutotags").getValue("autotags"),i=this.get("autotagModel"),l={},g=e.one(".machine-tags-list"),r=this;this.registerEventHandler(e.all(".tags-list, .machine-tags-list").on("click",function(h){if(h.target.hasClass("remove-tag")||h.target.hasClass("delete-tag")||h.target.hasClass("remove-autotag")||h.target.hasClass("delete-autotag")||h.target.hasClass("remove-dual-tag")||h.target.hasClass("delete-dual-tag")){h.preventDefault();var d,u,p=h.target.ancestor(".tag",!0);p?(d=p.getAttribute("data-tag-id"),o.remoteDelete(d).then(function(){s.removeFromList(d,"id"),p.remove(!0),0===s.toJSON().length&&0===n.toJSON().length?(e.addClass("empty"),r.fire("subviewViewEvent","tagsTagView:tagsEmpty")):0===s.toJSON().length&&e.one(".add-tag").setStyle("display","none")},function(){r.onError(r.intlMessage({intlName:"photo-page-scrappy.ERROR_DELETING_TAG"}))}),h.target.hasClass("remove-dual-tag")||h.target.hasClass("delete-dual-tag")?(u=p.getAttribute("data-autotag-id"),l.photo_id=r.photoId,l.autotags=u,i.remoteDelete(l).then(function(){n.remove(u,"id")},function(){a.warn("deleting the corresponding autotag for this usertag failed")}),t.rapidTracker.beacon(r.name,"dualTagDeleteClick",{type:u})):t.rapidTracker.beacon(r.name,"tagDeleteClick")):(p=h.target.ancestor(".autotag",!0),u=p.getAttribute("data-autotag-id"),l.photo_id=r.photoId,l.autotags=u,i.remoteDelete(l).then(function(){n.remove(u,"id"),p.remove(!0),0===n.toJSON().length&&0===s.toJSON().length&&(e.one(".add-tag").setStyle("display","none"),e.addClass("empty"),r.fire("subviewViewEvent","tagsTagView:tagsEmpty"))},function(){r.onError(r.intlMessage({intlName:"photo-page-scrappy.ERROR_DELETING_TAG"}))}),t.rapidTracker.beacon(r.name,"autotagDeleteClick",{type:u})),g.getDOMNode().childElementCount||e.one(".machine-tags-section").setStyle("display","none"),e.one(".tags-list").all(".end-of-the-line").removeClass("end-of-the-line"),e.one(".tags-list").all(".not-eol").removeClass("not-eol"),"block"===e.one(".machine-tags-section").getStyle("display")&&(e.one(".machine-tags-list").all(".end-of-the-line").removeClass("end-of-the-line"),e.one(".machine-tags-list").all(".not-eol").removeClass("not-eol"))}}))},processTag:function(e){var a,s,o;o=e.replace(/"(.*?)"/g,function(t,e){return e=e.replace(/(,)/g,function(t,e){return"{COMMA}"}),e=e.replace(/(\s+)/g,function(t,e){return e="{WHITESPACE"+e.charCodeAt(0)+"}"})}),s=o.indexOf(",")>-1?o.split(/,/):o.split(/\s+/);for(a in s)s[a]=s[a].replace(/\{WHITESPACE([0-9]+)\}/g,function(t,e){return e=String.fromCharCode(e)}),s[a]=s[a].replace(/\{COMMA\}/g,function(t,e){return","});return t.Array.each(s,function(e,a){e=t.Lang.trim(e),s[a]=e}),s=t.Array.filter(s,function(t,e){if(t.length>0)return!0})},setupRollOverTagEvents:function(){var t,e=this.get("container");this.registerEventHandler(e.all(".tags-list, .machine-tags-list").on("mouseover",function(e){if((t=e.target.ancestor(".tag, .autotag",!0))&&t.hasClass("can-remove-tag")){var a=t.ancestor(".tags-list")?t.ancestor(".tags-list").getDOMNode().offsetLeft:t.ancestor(".machine-tags-list").getDOMNode().offsetLeft,o=t.getDOMNode().offsetLeft;(t.ancestor(".tags-list")?parseInt(t.ancestor(".tags-list").getComputedStyle("width"),10):parseInt(t.ancestor(".machine-tags-list").getComputedStyle("width"),10))-(o-a+parseInt(t.getComputedStyle("width"),10))<=s.tagHoverMaxWidth?(t.removeClass("not-eol"),t.addClass("end-of-the-line")):(t.removeClass("end-of-the-line"),t.addClass("not-eol"))}}))},showAutotagsHelper:function(e){var a=this.get("container").one(".autotags-helper-icon"),s=this.templates("tags-helper-text");new t.Views.FluidDroparound({appContext:this.appContext,dismissOnOverlayClick:!0,showDropArrow:!0,anchorOffsetHorizontal:12,width:240,observePageResize:!0,anchorElement:a,htmlMessage:s({})}).show()},onError:function(e){return this.errorDialog=new t.Views.FluidModal({appContext:this.appContext,dismissOnOverlayClick:!0,dismissOnActionClick:!0,showCancelButton:!1,title:this.intlMessage({intlName:"common.OOPS"}),actionButtonLabel:this.intlMessage({intlName:"common.OK"}),message:e,darkOverlay:!0}),this.errorDialog.show(),this.errorDialog}})},"@VERSION@",{requires:["flickr-view","hermes-template-sub-photo-tags-tag-section","hermes-template-sub-photo-tags-tag","hermes-template-tags-helper-text","hermes-template-head-meta","url-helper"],optional:[],langBundles:["common","photo-page-scrappy"]});YUI.add("hermes-template-sub-photo-person",function(a,e){var n=a.Template.Handlebars.revive({1:function(a,e,n,l,t){var s,r=a.lambda,i=a.escapeExpression;return"data-"+i(r(null!=(s=null!=e?e.dataAttr:e)?s.key:s,e))+'="'+i(r(null!=(s=null!=e?e.dataAttr:e)?s.value:s,e))+'"'},3:function(a,e,n,l,t){var s;return a.escapeExpression(a.lambda(null!=(s=null!=e?e.buddyicon:e)?s.default:s,e))},5:function(a,e,n,l,t){var s;return a.escapeExpression("function"==typeof(s=null!=(s=n.buddyicon||(null!=e?e.buddyicon:e))?s:n.helperMissing)?s.call(null!=e?e:{},{name:"buddyicon",hash:{},data:t}):s)},7:function(a,e,n,l,t){return" ("+a.escapeExpression((n.intlMessage||e&&e.intlMessage||n.helperMissing).call(null!=e?e:{},{name:"intlMessage",hash:{intlName:"common.DELETED_USER"},data:t}))+")"},9:function(a,e,n,l,t){var s;return null!=(s=n.if.call(null!=e?e:{},null!=e?e.isPro:e,{name:"if",hash:{},fn:a.program(10,t,0),inverse:a.noop,data:t}))?s:""},10:function(a,e,n,l,t){var s;return null!=(s=a.invokePartial(l["pro-badge"],e,{name:"pro-badge",hash:{badgeType:null!=e?e.proBadge:e},data:t,helpers:n,partials:l,decorators:a.decorators}))?s:""},12:function(a,e,n,l,t){return'\t\t<a class="remove-person hide-text ui-icon-comment-delete" href="#">x</a>\n'},compiler:[7,">= 4.0.0"],main:function(a,e,n,l,t){var s,r,i=null!=e?e:{},o=n.helperMissing,p="function",u=a.escapeExpression;return'<li class="person" '+(null!=(s=n.if.call(i,null!=e?e.dataAttr:e,{name:"if",hash:{},fn:a.program(1,t,0),inverse:a.noop,data:t}))?s:"")+'>\n\t<div class="person-icon">\n\t\t<a class="'+u(typeof(r=null!=(r=n.extraClasses||(null!=e?e.extraClasses:e))?r:o)===p?r.call(i,{name:"extraClasses",hash:{},data:t}):r)+'" href="/photos/'+u(typeof(r=null!=(r=n.pathAlias||(null!=e?e.pathAlias:e))?r:o)===p?r.call(i,{name:"pathAlias",hash:{},data:t}):r)+'/" data-track="'+u(typeof(r=null!=(r=n.dataTrackPrefix||(null!=e?e.dataTrackPrefix:e))?r:o)===p?r.call(i,{name:"dataTrackPrefix",hash:{},data:t}):r)+'PersonIconClick">\n\t\t\t<div class="circle-icon" data-person-nsid="'+u(typeof(r=null!=(r=n.nsid||(null!=e?e.nsid:e))?r:o)===p?r.call(i,{name:"nsid",hash:{},data:t}):r)+'">\n\t\t\t\t<img class="show-person-menu" src="'+(null!=(s=n.if.call(i,null!=(s=null!=e?e.buddyicon:e)?s.default:s,{name:"if",hash:{},fn:a.program(3,t,0),inverse:a.program(5,t,0),data:t}))?s:"")+'" width="32" height="32">\n\t\t\t</div>\n\t\t\t<span class="person-name">\n\t\t\t\t'+u(typeof(r=null!=(r=n.displayname||(null!=e?e.displayname:e))?r:o)===p?r.call(i,{name:"displayname",hash:{},data:t}):r)+(null!=(s=n.if.call(i,null!=e?e.isDeleted:e,{name:"if",hash:{},fn:a.program(7,t,0),inverse:a.noop,data:t}))?s:"")+"\n\t\t\t</span>"+(null!=(s=(n.isFlipped||e&&e.isFlipped||o).call(i,"enable-pro-badge",{name:"isFlipped",hash:{},fn:a.program(9,t,0),inverse:a.noop,data:t}))?s:"")+"\n\t\t</a>\n"+(null!=(s=n.if.call(i,null!=e?e.showRemove:e,{name:"if",hash:{},fn:a.program(12,t,0),inverse:a.noop,data:t}))?s:"")+"\t</div>\n</li>\n"},usePartial:!0,useData:!0}),l={};a.Array.each(["pro-badge"],function(e){var n=a.Template.get("hermes/"+e);n&&(l[e]=n)}),a.Template.register("hermes/sub-photo-person",function(e,t){return t=t||{},t.partials=t.partials?a.merge(l,t.partials):l,n(e,t)})},"@VERSION@",{requires:["template-base","handlebars-base","hermes-template-pro-badge"]});YUI.add("hermes-template-invite-person",function(e,a){var n=e.Template.Handlebars.revive({1:function(e,a,n,t,l){var i,s=e.lambda,r=e.escapeExpression;return"data-"+r(s(null!=(i=null!=a?a.dataAttr:a)?i.key:i,a))+'="'+r(s(null!=(i=null!=a?a.dataAttr:a)?i.value:i,a))+'"'},3:function(e,a,n,t,l){return'\t\t<a class="remove-person hide-text ui-icon-comment-delete" href="#">x</a>\n'},compiler:[7,">= 4.0.0"],main:function(e,a,n,t,l){var i,s,r=null!=a?a:{},o=n.helperMissing,c=e.escapeExpression;return'<li class="person" '+(null!=(i=n.if.call(r,null!=a?a.dataAttr:a,{name:"if",hash:{},fn:e.program(1,l,0),inverse:e.noop,data:l}))?i:"")+'>\n\t<div class="person-icon">\n\t\t<div class="circle-icon">\n\t\t\t<img src="https://combo.staticflickr.com/pw/images/icon_unread.gif" width="'+c("function"==typeof(s=null!=(s=n.size||(null!=a?a.size:a))?s:o)?s.call(r,{name:"size",hash:{},data:l}):s)+'" height="'+c("function"==typeof(s=null!=(s=n.size||(null!=a?a.size:a))?s:o)?s.call(r,{name:"size",hash:{},data:l}):s)+'">\n\t\t</div>\n\t\t<p class="person-name">\n\t\t'+c("function"==typeof(s=null!=(s=n.email||(null!=a?a.email:a))?s:o)?s.call(r,{name:"email",hash:{},data:l}):s)+"\n\t\t</p>\n"+(null!=(i=n.if.call(r,null!=a?a.showRemove:a,{name:"if",hash:{},fn:e.program(3,l,0),inverse:e.noop,data:l}))?i:"")+"\t</div>\n</li>\n"},useData:!0}),t={};e.Array.each([],function(a){var n=e.Template.get("hermes/"+a);n&&(t[a]=n)}),e.Template.register("hermes/invite-person",function(a,l){return l=l||{},l.partials=l.partials?e.merge(t,l.partials):t,n(a,l)})},"@VERSION@",{requires:["template-base","handlebars-base"]});